package com.class04.config;

import com.class04.json4.EncodingInterceptor;


import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassDescription:
 * 项目的配置类，controller、handlermapping handlerAdapater
 * 加入ioc容器
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2023/12/4 8:07
 */
@EnableWebMvc//handlerAdapter配置了json转化器
//添加纪律委员handlermapping  添加宿舍长handlerAdapter
//给宿舍长handlerAdapter添加jacksonjson处理器
//@ComponentScan("com.class04.requestmapping1")
//@ComponentScan("com.class04.param2")
@ComponentScan("com.class04.share8")
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new EncodingInterceptor());
    }
//    //    添加handlermapping handlerAdapater
//    @Bean//纪律委员handlermapping
//    public RequestMappingHandlerMapping handlerMapping() {
//        return new RequestMappingHandlerMapping();
//    }
//
//    @Bean//宿舍长handlerAdapater
//    public RequestMappingHandlerAdapter handlerAdapter() {
//        return new RequestMappingHandlerAdapter();
//    }
}
